<?php
// public/index.php
//
// Step 1: APPLICATION_PATH is a constant pointing to our
// application/subdirectory. We use this to add our "library" directory
// to the include_path, so that PHP can find our Zend Framework classes.

ini_set('display_errors','on');
error_reporting(E_ALL ^ E_NOTICE);

define('PATH', realpath(dirname(__FILE__) . '/../'));
define('APPLICATION_PATH', PATH . '/application');
define('LIBRARY_PATH', PATH . '/library');
set_include_path(
    APPLICATION_PATH . PATH_SEPARATOR .
    LIBRARY_PATH . PATH_SEPARATOR .
    get_include_path()
);
// Step 2: AUTOLOADER - Set up autoloading.
// This is a nifty trick that allows ZF to load classes automatically so
// that you don't have to litter your code with 'include' or 'require'
// statements.
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();

// Step 3: REQUIRE APPLICATION BOOTSTRAP: Perform application-specific setup
// This allows you to setup the MVC environment to utilize. Later you
// can re-use this file for testing your applications.
// The try-catch block below demonstrates how to handle bootstrap
// exceptions. In this application, if defined a different
// APPLICATION_ENVIRONMENT other than 'production', we will output the
// exception and stack trace to the screen to aid in fixing the issue
try {
    require '../application/bootstrap.php';
} catch (Exception $exception) {
    echo '<html><body><center>'
       . 'An exception occured while bootstrapping the application.';
    if (defined('APPLICATION_ENVIRONMENT')
        && APPLICATION_ENVIRONMENT != 'production'
    ) {
        $mailStr = '<br /><br />' . $exception->getMessage() . '<br />'
           . '<div align="left">Stack Trace:'
           . '<pre>' . $exception->getTraceAsString() . '</pre></div>';
        echo $mailStr;
        
        $mailStr .= '<div>$_GET</div>';
        $mailStr .= print_r($_GET,true);
        $mailStr .= '<div>$_POST</div>';
        $mailStr .= print_r($_POST,true);
        $mailStr .= '<div>$_SESSION</div>';
        $mailStr .= print_r($_SESSION,true);
        $mailer = new Zend_Mail();
        $mailer->setBodyHtml($mailStr);
        $mailer->addTo('hermen@vandenhoorn.net');
    }
    echo '</center></body></html>';
    exit(1);
}



